<?php
session_start();
class cadastroUsuario extends Tpage{

	public function saveRecord($sender, $param){
		$usuario = new usuarioRecord();

		$usuario->BooleanIsAdmin = false;

		$usuario->StrEmail = $this->email->Text;
		$usuario->StrNome = $this->nome->Text;
		$usuario->StrSenha = $this->senha->Text;
		$usuario->StrUsuario = $this->login->Text;
		$usuario->StrFone = $this->fone->Text;
		$usuario->StrCel = $this->cel->Text;
		$usuario->save();

		$this->mensagen->Text ="cadastro efetuado com sucesso";
		$this->email->Text = "";
		$this->nome->Text = "";
		$this->senha->Text = "";
		$this->login->Text = "";
		$this->fone->Text = "";
		$this->cel->Text = "";
		
		$this->panel1->render($param->NewWriter);
		
		

	}

	public function onLoad($param)
	{
		parent::onLoad($param);
		if(!$this->IsPostBack)
		{
				
			$this->usuarioLogado->Text = $_SESSION['usuario'];
		}
		
		if($_SESSION['idUsuario'] == null){
			$this->Response->  redirect("?page=home");
		}
			
	}
}
?>